﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Web_Pages_UserControls_ShowListAccount : System.Web.UI.UserControl
{
    private AdminBLL adminBLL;

    protected void Page_Load(object sender, EventArgs e)
    {
        this.adminBLL = new AdminBLL();
        this.BindGridData();

    }

    protected void BindGridData()
    {
        List<Users> listUsers = this.adminBLL.GetIUsers.GetAllUsers();
        if (listUsers.Count != 0)
        {
            gvListAccount.DataSource = listUsers;
            
            gvListAccount.DataBind();

        }
        else
        {
            Response.Write("<script>alert('Danh sách rỗng')</script>");
        }      
    }
    protected void gvListAccount_PageIndexChanged(object sender, EventArgs e)
    {
       
    }
    protected void gvListAccount_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvListAccount.PageIndex = e.NewPageIndex;
        BindGridData();  
    }
    protected void gvListAccount_RowEditing(object sender, GridViewEditEventArgs e)
    {
        gvListAccount.EditIndex = e.NewEditIndex;
        this.BindGridData();
    }
    protected void gvListAccount_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
    {
        gvListAccount.EditIndex = -1;
        this.BindGridData();
    }
}